function a(nums){
    let j=0
    for(let i=0;i<nums.length;i++){
        if(nums[i]!==0){
            [nums[i],nums[j]]=[nums[j],nums[i]];
            j++;
        }
    }
    return nums;

}
console.log(a([0,1,0,3,12]));